package org.ki.gra.aktorzy;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;

/**
 * User: kieronsk
 * Date: 10/9/12
 * Time: 5:07 PM
 */
public class StatycznyAktor extends Actor {

    private TextureRegion region;
    private Texture texture;

    public StatycznyAktor(String fileName,int szer, int wys) {
        super();

        texture = new Texture(Gdx.files.internal(fileName));
        region = new TextureRegion(texture,szer,wys);
        width=szer/(float)wys;
        height=1;
    }

    @Override
    public void draw(SpriteBatch batch, float parentAlpha) {
        Color c = this.color;
        c.a *= parentAlpha;
        batch.setColor(c);
        batch.draw(region, x, y, originX, originY, width, height, scaleX, scaleY,rotation);
        //batch.draw(region,0,0);
    }

    @Override
    public Actor hit(float x, float y) {
        if (x>0 && x<this.width && y>0 && y<this.height)
            return this;
        return null;
    }
}
